<!--
<template>
  <h2>当前求和为:{{ sum }}</h2>
  <button @click="sum++">点我x+1</button>
  <hr>
  <h2>姓名:{{ person.name }}</h2>
  <h2>年龄:{{ person.age }}</h2>
  <h2>展示薪水:{{ person.job.j1.salery }}K</h2>
  <button @click="person.name+='~'">修改姓名</button>
  <button @click="person.age++">增长年龄</button>
  <button @click="person.job.j1.salery++">涨薪</button>

</template>

<script>
//TODO  provide+inject-&#45;&#45;用于组件间通信的一种方式(主要用于跨级间的组件通信)
import { reactive, ref} from "vue";

export default {
  name: 'Demo',
  setup() {
    //数据
    let sum = ref(0)
    let person = reactive({
      name: '张三',
      age: 18,
      job: {
        j1: {
          salery: 20
        }
      }
    })



    return {
      sum,
      //全部交出去
      person,
      //分开交出去(当有属性添加时,不会呗再次执行)
    }
  }
}
</script>

<style>
</style>
-->
